<?php


namespace App\Models\MainDB;


use Illuminate\Database\Eloquent\Model;

class MallOrdersHistory extends Model
{
    protected $table = 'ln_mall_orders_history';     //数据库内完整表名

    protected $primaryKey = 'id';    //主键名

    public $timestamps = false;

    public function mall_products()
    {
        return $this->hasOne('App\Models\MainDB\MallProducts', 'id', 'product_id');
    }

    public function mall_categories()
    {
        return $this->hasOne('App\Models\MainDB\MallCategories', 'id', 'category_id');
    }

    //购买人id
    public function user_buyer()
    {
        return $this->hasOne('App\Models\MainDB\UserData', 'user_id', 'user_id_buyer');
    }

    //拥有者id
    public function user_owner()
    {
        return $this->hasOne('App\Models\MainDB\UserData', 'user_id', 'user_id_owner');
    }
}